Optimal. Leaf size=184 \[ -\frac {x \left (2 b c d-a \left (c^2-d^2\right )\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b^3 \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right ) (b c-a d)^2}+\frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}+\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^2 (b c-a d)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.51, antiderivative size = 184, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.120, Rules used = {3569, 3651, 3530} \[ -\frac {x \left (2 b c d-a \left (c^2-d^2\right )\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b^3 \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right ) (b c-a d)^2}+\frac {d^2}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}+\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^2 (b c-a d)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3530
Rule 3569
Rule 3651
Rubi steps
\begin {align*} \int \frac {1}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx &=\frac {d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac {\int \frac {-a c d+b \left (c^2+d^2\right )-d (b c-a d) \tan (e+f x)+b d^2 \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))} \, dx}{(b c-a d) \left (c^2+d^2\right )}\\ &=-\frac {\left (2 b c d-a \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac {b^3 \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right ) (b c-a d)^2}+\frac {\left (d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(b c-a d)^2 \left (c^2+d^2\right )^2}\\ &=-\frac {\left (2 b c d-a \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b^3 \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right ) (b c-a d)^2 f}+\frac {d^2 \left (2 a c d-b \left (3 c^2+d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right )^2 f}+\frac {d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 2.25, size = 306, normalized size = 1.66 \[ \frac {\frac {2 b d^2 \left (a^2+b^2\right ) \left (b \left (3 c^2+d^2\right )-2 a c d\right ) \log (c+d \tan (e+f x))-2 b^4 \left (c^2+d^2\right )^2 \log (a+b \tan (e+f x))+(b c-a d)^2 \left (a \sqrt {-b^2} \left (c^2-d^2\right )+2 b c d \left (a-\sqrt {-b^2}\right )+b^2 \left (c^2-d^2\right )\right ) \log \left (\sqrt {-b^2}-b \tan (e+f x)\right )+(b c-a d)^2 \left (a \sqrt {-b^2} \left (d^2-c^2\right )+2 b c d \left (a+\sqrt {-b^2}\right )+b^2 \left (c^2-d^2\right )\right ) \log \left (\sqrt {-b^2}+b \tan (e+f x)\right )}{2 b \left (a^2+b^2\right ) \left (c^2+d^2\right ) (b c-a d)}-\frac {d^2}{c+d \tan (e+f x)}}{f \left (c^2+d^2\right ) (a d-b c)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 1.06, size = 711, normalized size = 3.86 \[ \frac {2 \, {\left (a^{2} b + b^{3}\right )} c d^{4} - 2 \, {\left (a^{3} + a b^{2}\right )} d^{5} + 2 \, {\left (a b^{2} c^{5} - a^{3} c d^{4} - 2 \, {\left (a^{2} b + b^{3}\right )} c^{4} d + {\left (a^{3} + 3 \, a b^{2}\right )} c^{3} d^{2}\right )} f x + {\left (b^{3} c^{5} + 2 \, b^{3} c^{3} d^{2} + b^{3} c d^{4} + {\left (b^{3} c^{4} d + 2 \, b^{3} c^{2} d^{3} + b^{3} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (3 \, {\left (a^{2} b + b^{3}\right )} c^{3} d^{2} - 2 \, {\left (a^{3} + a b^{2}\right )} c^{2} d^{3} + {\left (a^{2} b + b^{3}\right )} c d^{4} + {\left (3 \, {\left (a^{2} b + b^{3}\right )} c^{2} d^{3} - 2 \, {\left (a^{3} + a b^{2}\right )} c d^{4} + {\left (a^{2} b + b^{3}\right )} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left ({\left (a^{2} b + b^{3}\right )} c^{2} d^{3} - {\left (a^{3} + a b^{2}\right )} c d^{4} - {\left (a b^{2} c^{4} d - a^{3} d^{5} - 2 \, {\left (a^{2} b + b^{3}\right )} c^{3} d^{2} + {\left (a^{3} + 3 \, a b^{2}\right )} c^{2} d^{3}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left ({\left (a^{2} b^{2} + b^{4}\right )} c^{6} d - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{5} d^{2} + {\left (a^{4} + 3 \, a^{2} b^{2} + 2 \, b^{4}\right )} c^{4} d^{3} - 4 \, {\left (a^{3} b + a b^{3}\right )} c^{3} d^{4} + {\left (2 \, a^{4} + 3 \, a^{2} b^{2} + b^{4}\right )} c^{2} d^{5} - 2 \, {\left (a^{3} b + a b^{3}\right )} c d^{6} + {\left (a^{4} + a^{2} b^{2}\right )} d^{7}\right )} f \tan \left (f x + e\right ) + {\left ({\left (a^{2} b^{2} + b^{4}\right )} c^{7} - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{6} d + {\left (a^{4} + 3 \, a^{2} b^{2} + 2 \, b^{4}\right )} c^{5} d^{2} - 4 \, {\left (a^{3} b + a b^{3}\right )} c^{4} d^{3} + {\left (2 \, a^{4} + 3 \, a^{2} b^{2} + b^{4}\right )} c^{3} d^{4} - 2 \, {\left (a^{3} b + a b^{3}\right )} c^{2} d^{5} + {\left (a^{4} + a^{2} b^{2}\right )} c d^{6}\right )} f\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 1.24, size = 541, normalized size = 2.94 \[ \frac {\frac {2 \, b^{4} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{2} b^{3} c^{2} + b^{5} c^{2} - 2 \, a^{3} b^{2} c d - 2 \, a b^{4} c d + a^{4} b d^{2} + a^{2} b^{3} d^{2}} + \frac {2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} - \frac {{\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} - \frac {2 \, {\left (3 \, b c^{2} d^{3} - 2 \, a c d^{4} + b d^{5}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{b^{2} c^{6} d - 2 \, a b c^{5} d^{2} + a^{2} c^{4} d^{3} + 2 \, b^{2} c^{4} d^{3} - 4 \, a b c^{3} d^{4} + 2 \, a^{2} c^{2} d^{5} + b^{2} c^{2} d^{5} - 2 \, a b c d^{6} + a^{2} d^{7}} + \frac {2 \, {\left (3 \, b c^{2} d^{3} \tan \left (f x + e\right ) - 2 \, a c d^{4} \tan \left (f x + e\right ) + b d^{5} \tan \left (f x + e\right ) + 4 \, b c^{3} d^{2} - 3 \, a c^{2} d^{3} + 2 \, b c d^{4} - a d^{5}\right )}}{{\left (b^{2} c^{6} - 2 \, a b c^{5} d + a^{2} c^{4} d^{2} + 2 \, b^{2} c^{4} d^{2} - 4 \, a b c^{3} d^{3} + 2 \, a^{2} c^{2} d^{4} + b^{2} c^{2} d^{4} - 2 \, a b c d^{5} + a^{2} d^{6}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.37, size = 412, normalized size = 2.24 \[ \frac {b^{3} \ln \left (a +b \tan \left (f x +e \right )\right )}{f \left (d a -c b \right )^{2} \left (a^{2}+b^{2}\right )}-\frac {d^{2}}{f \left (d a -c b \right ) \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {2 d^{3} \ln \left (c +d \tan \left (f x +e \right )\right ) a c}{f \left (d a -c b \right )^{2} \left (c^{2}+d^{2}\right )^{2}}-\frac {3 d^{2} \ln \left (c +d \tan \left (f x +e \right )\right ) c^{2} b}{f \left (d a -c b \right )^{2} \left (c^{2}+d^{2}\right )^{2}}-\frac {d^{4} \ln \left (c +d \tan \left (f x +e \right )\right ) b}{f \left (d a -c b \right )^{2} \left (c^{2}+d^{2}\right )^{2}}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a c d}{f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c^{2} b}{2 f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b \,d^{2}}{2 f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) a \,c^{2}}{f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}-\frac {\arctan \left (\tan \left (f x +e \right )\right ) a \,d^{2}}{f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}}-\frac {2 \arctan \left (\tan \left (f x +e \right )\right ) b c d}{f \left (a^{2}+b^{2}\right ) \left (c^{2}+d^{2}\right )^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.75, size = 384, normalized size = 2.09 \[ \frac {\frac {2 \, b^{3} \log \left (b \tan \left (f x + e\right ) + a\right )}{{\left (a^{2} b^{2} + b^{4}\right )} c^{2} - 2 \, {\left (a^{3} b + a b^{3}\right )} c d + {\left (a^{4} + a^{2} b^{2}\right )} d^{2}} + \frac {2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}} + \frac {2 \, d^{2}}{b c^{4} - a c^{3} d + b c^{2} d^{2} - a c d^{3} + {\left (b c^{3} d - a c^{2} d^{2} + b c d^{3} - a d^{4}\right )} \tan \left (f x + e\right )} - \frac {2 \, {\left (3 \, b c^{2} d^{2} - 2 \, a c d^{3} + b d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{b^{2} c^{6} - 2 \, a b c^{5} d - 4 \, a b c^{3} d^{3} - 2 \, a b c d^{5} + a^{2} d^{6} + {\left (a^{2} + 2 \, b^{2}\right )} c^{4} d^{2} + {\left (2 \, a^{2} + b^{2}\right )} c^{2} d^{4}} - \frac {{\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 7.36, size = 374, normalized size = 2.03 \[ \frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\frac {b\,c^2+2\,a\,c\,d-b\,d^2}{\left (a^2+b^2\right )\,{\left (c^2+d^2\right )}^2}+\frac {b\,d^2}{{\left (a\,d-b\,c\right )}^2\,\left (c^2+d^2\right )}-\frac {2\,c\,d^2}{\left (a\,d-b\,c\right )\,{\left (c^2+d^2\right )}^2}\right )}{f}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (b\,\left (3\,c^2\,d^2+d^4\right )-2\,a\,c\,d^3\right )}{f\,\left (a^2\,c^4\,d^2+2\,a^2\,c^2\,d^4+a^2\,d^6-2\,a\,b\,c^5\,d-4\,a\,b\,c^3\,d^3-2\,a\,b\,c\,d^5+b^2\,c^6+2\,b^2\,c^4\,d^2+b^2\,c^2\,d^4\right )}-\frac {d^2}{f\,\left (a\,d-b\,c\right )\,\left (c^2+d^2\right )\,\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a\,c^2-a\,d^2-2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,f\,\left (a\,d^2-a\,c^2+2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________